import LucideIcon from '@/components/design/components/common/LucideIcon.vue';
import EditItem from '@/components/design/components/common/EditItem.vue';
import CollapseTitle from '@/components/design/components/common/CollapseTitle.vue';
import 'virtual:svg-icons-register';

import './../components/design/styles/index.less';

import {
  createDiscreteApi,
  create,
  NColorPicker,
  NConfigProvider,
  NMessageProvider,
  NDialogProvider,
  NButton,
  NButtonGroup,
  NTag,
  NCollapse,
  NCollapseItem,
  NDataTable,
  NPopover,
  NDrawer,
  NDrawerContent,
  NModal,
  NCode,
  NForm,
  NFormItem,
  NInput,
  NInputNumber,
  NRadio,
  NRadioGroup,
  NCheckbox,
  NCheckboxGroup,
  NSelect,
  NSwitch,
} from 'naive-ui';

const naive = create({
  components: [
    NColorPicker,
    NConfigProvider,
    NMessageProvider,
    NDialogProvider,
    NButton,
    NButtonGroup,
    NTag,
    NCollapse,
    NCollapseItem,
    NDataTable,
    NPopover,
    NDrawer,
    NDrawerContent,
    NModal,
    NCode,
    NForm,
    NFormItem,
    NInput,
    NInputNumber,
    NRadio,
    NRadioGroup,
    NCheckbox,
    NCheckboxGroup,
    NSelect,
    NSwitch,
  ],
});

const { message } = createDiscreteApi(['message', 'dialog', 'notification', 'loadingBar']);
window.__messageBox = message;
/**
 * 全局注册自定义组件
 * @param app
 */
export function setupDesign(app) {
  app.use(naive);
  console.log(123);
  app.component('LucideIcon', LucideIcon);
  app.component('EditItem', EditItem);
  app.component('CollapseTitle', CollapseTitle);
}
